package com.heatup.apt.common.util;

import java.io.Serializable;
import java.util.Map;

/**
 * service层统一返回bean
 * <P>File name : ResultBean.java </P>
 * <P>Author : xwsingly </P> 
 * <P>Date : 2015年10月21日 </P>
 * <P>Version : 0.0 </P>
 */
public class ResultBean implements Serializable{

	private static final long serialVersionUID = -9029306971310647503L;
	
	/**
	 * 请求成功标识
	 */
	public final static int CODE_SUCCESS = 1;
	/**
	 * 请求失败标识
	 */
	public final static int CODE_FAIL = 0;
	/**
	 * 请求失败，参数为空，或者参数异常
	 */
	public final static int CODE_PARAMS_FAIL = 2;
	/**
	 * 特殊场景
	 */
	public final static int CODE_UPDATE_fail = 3;
	/**
	 * 默认消息说明
	 */
	public final static String ERROR_MESSAGE = "非法请求!";
	/**
	 * 没有登录
	 */
	public final static String NO_LOGIN = "请登录系统!";
	/**
	 * 请求返回编号
	 */
	private int code;
	/**
	 * 请求返回数据
	 */
	private Map<String, Object> data;
	/**
	 * 请求返回message
	 */
	private String msg;
	
	public ResultBean() {
	}
	
	public ResultBean(int code, String msg) {
		this.code = code;
        this.msg = msg;
	}
	
	public ResultBean(int code, Map<String, Object> data, String msg) {
		this.code = code;
        this.data = data;
        this.msg = msg;
	}
	
	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public Map<String, Object> getData() {
		return data;
	}
	public void setData(Map<String, Object> data) {
		this.data = data;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}

	@Override
	public String toString() {
		return "ResultBean [code=" + code + ", data=" + data + ", msg=" + msg
				+ "]";
	}
	
	
}
